#include "stdafx.h"
#include "Box.h"
#include "BoxComponent.h"

Box::Box(Ogre::Vector3 position, Ogre::Vector3 dimensions, bool movable) {
	m_physicsComponent = new BoxComponent(position, dimensions, 1, movable);
	m_physicsComponent->setOffset(Ogre::Vector3(0, 0, 0));
	m_position = position;
	m_dimensions = dimensions;
}

Box::~Box() {
}

void Box::updateLogic() {
}

void Box::createMovableObject(Ogre::SceneManager* sceneMgr, unsigned int id) {
	//Create ground
	Ogre::Plane plane(Ogre::Vector3::UNIT_Y, 0);

	//create a unique name
	std::stringstream out;
	out << "BoxEntity" << id;
	std::string idString = out.str();
	
	Ogre::Entity* entity = sceneMgr->createEntity(idString, "Prefab_Cube");
 
    entity->setMaterialName("Examples/Rockwall");

	this->addMovableObject(entity);
	m_node->attachObject(entity);
	m_node->setScale(m_dimensions/50);
}